package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DiscountMapper;
import com.ruoyi.system.domain.Discount;
import com.ruoyi.system.service.IDiscountService;
import com.ruoyi.common.core.text.Convert;

/**
 * 优惠卷模板Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-04-08
 */
@Service
public class DiscountServiceImpl implements IDiscountService 
{
    @Autowired
    private DiscountMapper discountMapper;

    /**
     * 查询优惠卷模板
     * 
     * @param uuid 优惠卷模板ID
     * @return 优惠卷模板
     */
    @Override
    public Discount selectDiscountById(String uuid)
    {
        return discountMapper.selectDiscountById(uuid);
    }

    /**
     * 查询优惠卷模板列表
     * 
     * @param discount 优惠卷模板
     * @return 优惠卷模板
     */
    @Override
    public List<Discount> selectDiscountList(Discount discount)
    {
        return discountMapper.selectDiscountList(discount);
    }

    /**
     * 新增优惠卷模板
     * 
     * @param discount 优惠卷模板
     * @return 结果
     */
    @Override
    public int insertDiscount(Discount discount)
    {
        discount.setCreateTime(DateUtils.getNowDate());
        return discountMapper.insertDiscount(discount);
    }

    /**
     * 修改优惠卷模板
     * 
     * @param discount 优惠卷模板
     * @return 结果
     */
    @Override
    public int updateDiscount(Discount discount)
    {
        return discountMapper.updateDiscount(discount);
    }

    /**
     * 删除优惠卷模板对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDiscountByIds(String ids)
    {
        return discountMapper.deleteDiscountByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除优惠卷模板信息
     * 
     * @param uuid 优惠卷模板ID
     * @return 结果
     */
    @Override
    public int deleteDiscountById(String uuid)
    {
        return discountMapper.deleteDiscountById(uuid);
    }
}
